<?php
global $_W, $_GPC, $code;
pdo_fetchall("
CREATE TABLE IF NOT EXISTS " . tablename($this->table_supplier) . " (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `weid` int(11) DEFAULT '0',
  `storeid` int(11) DEFAULT '0',
  `username` varchar(100) DEFAULT '',
  `mobile` varchar(20) DEFAULT '',
  `company` varchar(100) DEFAULT '',
  `address` varchar(200) DEFAULT '',
  `status` tinyint(1) DEFAULT '0',
  `remark` text DEFAULT '',
  `dateline` int(11) DEFAULT '0',
  `displayorder` tinyint(3) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");
pdo_fetchall("
CREATE TABLE IF NOT EXISTS " . tablename($this->table_material) . " (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `weid` int(11) DEFAULT '0',
  `storeid` int(11) DEFAULT '0',
  `supplierid` int(11) DEFAULT '0',
  `name` varchar(100) DEFAULT '',
  `unit` varchar(20) DEFAULT '',
  `option` varchar(100) DEFAULT '',
  `count` int(11) DEFAULT '0',
  `price` decimal(10,2) DEFAULT '0.00',
  `address` varchar(200) DEFAULT '',
  `dateline` int(11) DEFAULT '0',
  `displayorder` tinyint(3) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");
pdo_fetchall("
CREATE TABLE IF NOT EXISTS " . tablename($this->table_material_log) . " (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `weid` int(11) DEFAULT '0',
  `storeid` int(11) DEFAULT '0',
  `supplierid` int(11) DEFAULT '0',
  `materialid` int(11) DEFAULT '0',
  `count` int(11) DEFAULT '0',
  `price` decimal(10,2) DEFAULT '0.00',
  `dateline` int(11) DEFAULT '0',
  `displayorder` tinyint(3) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;");
if (!pdo_fieldexists($this->table_goods, 'materials')) {
    pdo_fetchall("ALTER TABLE ".tablename($this->table_goods)." ADD `materials` text;");
}
echo $this->table_supplier;